import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_demo/ui/pages/main/init_bottom_navigation_bar.dart';

class MainPage extends StatefulWidget {
  static final String name = "/";

  @override
  _MainPageState createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  int _current = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: IndexedStack(
        index: _current,
        children: AppBottomNavigationBar.pages,
      ),
      bottomNavigationBar: BottomNavigationBar(
        currentIndex: _current,
        items: AppBottomNavigationBar.items,
        onTap: (index){
          setState(() {
            _current = index;
          });
        },
      ),
    );
  }
}
